﻿using SharpDX;
using System.Drawing;
using System.Windows.Forms;

namespace MikadoShooter
{
    public class DrawMouse : DrawBase
    {
        private readonly float xRes;
        private readonly float yRes;
        private readonly StatusBar statusBar;

        public DrawMouse(DXWindow dXWindow) : base(CalcVerticals(), new Vector4Mouse(CalcVerticals()))
        {
            statusBar = new StatusBar();

            xRes = 2.0f / (dXWindow.RenderForm.Bounds.Width - 10);   //- 5)
            yRes = 2.0f / (dXWindow.RenderForm.Bounds.Height - statusBar.Size.Height - 5);  //- statusBar.Size.Height - 5

            
        }

        public void Update(Point location, Vector4 color)
        {
            Data[0] = new Vector4(
                xRes * (Cursor.Position.X - location.X - 10) - 1.0f,
                1.0f - yRes * (Cursor.Position.Y - location.Y - statusBar.Size.Height - 5),
                0.0f, 1.0f);

            Data[1] = color;
        }

        private static int CalcVerticals()
        {
            return 1;
        }
    }
}